<?php

use yii\helpers\Html;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $searchModel app\models\WriteQuestionSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->registerCssFile('@web/css/backstage.css',['depends'=>['app\assets\AppAsset']]);
$this->title = '写作题目';
$this->params['breadcrumbs'][] = $this->title;
$this->registerJsFile('@web/js/setHeight.js',['depends'=>['app\assets\AppAsset']]);
$this->registerJsFile('@web/js/searchadmin.js',['depends'=>['app\assets\AppAsset']]);
?>
<div class="box">
<div class="write-question-index">
    <div class="speaking-content-index">
        <div class="main"><!--右侧内容-->
            <div class="cont">
                <div class="title">题目概况</div>
                <div class="details">
                    <div class="details_operation clearfix">
                        <div class="bui_select">
                            <!--                        <input type="button" value="添&nbsp;&nbsp;加" class="add">-->
                            <?= Html::a('添加', ['create'], ['class' => 'btn add']) ?>
                        </div>
                        <div class="fr">
                            <div class="text">
                                <span>日期：</span>
                                <div class="bui_select">
                                    <select name="" id="" class="select">
                                        <option value="1"><?= date("Y-m-d "); ?></option>
                                    </select>
                                </div>
                            </div>
                            <div class="text">
                                <span</span>
                                <div class="bui_select">
                                    <select name="" id="" class="select">
                                        <option value="1">Keep good men company and you shall be of the number.</option>
                                    </select>
                                </div>
                            </div>
                            <div class="text">
                                <span></span>
<!--                                <input type="text" value="" class="search">-->
                            </div>
                        </div>
                    </div>
                    <table class="table" cellspacing="0" cellpadding="0">
                        <thead>
                        </thead>
                        <tbody>
                        <tr>
                            <td><h3><?=Html::encode($this->title)?></h3></td>
                        </tr>
                        <tr>
    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

            //'id',
            'tnum',
            'info:ntext',
            'question:ntext',
            //'reading_content:ntext',
             'url',
            // 'hearing_content:ntext',
            [
                'class' => 'yii\grid\DataColumn', //由于是默认类型，可以省略
                'attribute' => "一级分类",
                'value' => function ($data) {
                    $data2 = \app\models\Class1::findOne($data['class1_id'])->name;
                    return $data2; // 如果是数组数据则为 $data['name'] ，例如，使用 SqlDataProvider 的情形。
                },
            ],
            [
                'class' => 'yii\grid\DataColumn', //由于是默认类型，可以省略
                'attribute' => "二级分类",
                'value' => function ($data) {
                    $data1 = \app\models\WriteQuestion::findOne($data['id'])->class_num;
                    $data2 = \app\models\Class2::findOne($data['class2_id'])->name;
                    return $data2." ".$data1; // 如果是数组数据则为 $data['name'] ，例如，使用 SqlDataProvider 的情形。
                },
            ],
             // 'num',
            // 'diff',

            ['class' => 'yii\grid\ActionColumn'],
        ],
    ]); ?>
                        </tr>

                        </tbody>
                    </table>
                </div>
            </div>
        </div>
</div>
</div>
